<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let app = Symbol('最简单的声明方式') // 括号中的文字是对symbol的描述 说明
    console.log(app,app.description);// description是symbol的描述
    let obj = Symbol.for('.for的声明方式')
    console.log(obj,obj.description);
    

    let app0 = Symbol('最简单的声明方式0')
    let app1 = Symbol('最简单的声明方式1')
    let app2 = Symbol('最简单的声明方式2')
    try{
      console.log(Symbol.keyFor(最简单的声明方式2));
    }catch(error){
      console.log(error);
      
    }
    
    /*
    Uncaught ReferenceError: 最简单的声明方式2 is not defined
    at symbol声明方式.html:19(anonymous) @ symbol声明方式.html:19
    */
    let obj0 = Symbol.for('obj0')
    let obj1 = Symbol.for('obj1')
    let obj2 = Symbol.for('obj2')
    console.log(Symbol.keyFor(obj1));
    /*
    Uncaught ReferenceError: 最简单的声明方式2 is not defined
    at symbol声明方式.html:19(anonymous) @ symbol声明方式.html:19
    */
  </script>
</body>
</html>